package com.cn.why.film.filmindex.face;

/**
 * 线程测试
 */
public class ThreadTest extends Thread {
    volatile boolean flag = false;
    int i = 0;

    public void run() {
        while (!flag) {
            i++;
        }
    }

    public static void main(String[] args) throws Exception {
        ThreadTest vt = new ThreadTest();
        vt.start();
        Thread.sleep(2000);
        vt.flag = true;
        System.out.println("stop   " + vt.i);
    }
}
